﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TitleLike.ascx.cs" Inherits="Admin_ascx_TitleLike" %>
<asp:TextBox ID="titleTxt" runat="server" Width="199px" ValidationGroup="Edit"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
    ControlToValidate="titleTxt" Display="Dynamic" ErrorMessage="*" 
    SetFocusOnError="True" ValidationGroup="Edit"></asp:RequiredFieldValidator><span id="titlelike"></span><asp:HiddenField
        ID="colname" runat="server" />
<script language="javascript" type="text/javascript">
    $(function() {
        $("#title_EditShow_titleTxt").change(function() {
            var url = location.href;
            var value = $(this).val();
            var tab = qstring(url, "tab");
            var xml = qstring(url, "xml");
            var id = qstring(url, "id");
            var col = $("#title_EditShow_colname").val();            
            if (id == "") id = 0;
            var url1 = "ashx/NewsTitleLikeCount.ashx?tab=" + tab + "&col=" + col + "&key=" + escape(value) + "&id=" + id;
            $.get(url1, {}, function(data) {
                var cnt = parseInt(data);
                if (cnt > 0) {
                    $("#titlelike").html(" 找到<font color='red'><b>" + cnt + "</b></font>条相似标题的新闻，<a href='TitleLike.aspx?tab=" + tab + "&xml=" + xml + "&col=" + col + "&key=" + value + "&id=" + id + "' target='_blank'>查看</a>")
                }
            });
        });
    });

    function qstring(url, pname) {
        var urls = url.split("?");
        if (urls.length > 1) {
            var ps = urls[1].split("&");
            for (var i = 0; i < ps.length; i++) {
                var vs = ps[i].split("=");
                if (vs[0] == pname) {
                    if (vs.length > 1) return vs[1];
                }
            }
        }
        return "";
    }
</script>

